home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shw_realpowerwheeldoors.cog < prev    next >
Text File  |  1999-11-15  |  28KB  |  908 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shw_PowerwheelDoors.cog
  4. #
  5. # Sluiceway Alternating Script
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11. symbols
  12.  
  13.         message         startup
  14.         message         activated
  15.         message         arrived
  16.         message         user0
  17.  
  18.         cog     camcog
  19.         cog     gearcog0
  20.         cog     gearcog1
  21.         cog     gearcog2
  22.         cog     gearcog3
  23.         #    props
  24.         thing       lever
  25.         thing       door0   linkID=1
  26.         thing       door1   linkID=1
  27.         thing       door2   linkID=1
  28.         thing       door3   linkID=1
  29.         thing       wheel
  30.         thing       wheelbracket
  31.         thing       lpulley
  32.         thing       rpulley
  33.         thing       rope
  34.         #    actors
  35.         thing       player                  local
  36.         thing        indy            nolink
  37.         # prop targets
  38.         thing        camerapos
  39.         thing       doorcampos
  40.         thing       doorcamtarget
  41.         thing       wheelcampos
  42.         thing       wheelcampos1
  43.         thing       wheelcampos2
  44.         thing       wheelcampos3
  45.         thing        wheelpos0
  46.         thing        wheelpos1
  47.         thing        wheelpos2
  48.         thing        wheelpos3
  49.         thing        wheelpos4
  50.         thing        wheelpos5
  51.         thing        wheelpos6
  52.         thing        wheelpos7
  53.         thing        lpulleypos0
  54.         thing        lpulleypos1
  55.         thing        rpulleypos0
  56.         thing        rpulleypos1
  57.         
  58.  
  59.         thing        ropepos0
  60.         thing        ropepos1
  61.         #    sluiceway surfaces
  62.         surface     surf0
  63.         surface     surf1
  64.         surface     surf2
  65.         surface     surf3
  66.         #    prop keyframes            
  67.         keyframe    pulleysright=shw_wheel_ply_bck.key      
  68.         keyframe    pulleysleft=shw_wheel_ply_fwd.key      
  69.         keyframe    wheelspin=shw_whl.key      
  70.         #    actor keyframes
  71.         keyframe    in_pull=in_pull_lever_down.key        local
  72.         keyframe    lever_down=gen_lever.key            local                          
  73.         #    sounds
  74.         sound   leverpull=nub_lever_pull_c.wav          local
  75.         sound   leverset=nub_lever_reset_c.wav          local
  76.         sound   wheelstart=shw_pwheel_start.wav         local
  77.         sound   wheelmove=shw_pwheel_run.wav              local
  78.         sound   wheelstop=shw_pwheel_end.wav              local
  79.         sound   locowave=teo_gears_rot_c.wav              local
  80.         sound   opensound=nub_trapdoor_fall_c.wav       local
  81.         sound    dangercue=mus_gen_danger1.wav            local
  82.  
  83.         #    camera variables
  84.         int    curCam        local
  85.         int    curLook        local
  86.         #    mechanic variables
  87.         int ActivatePos        local
  88.         int    door0open=0     local
  89.         int    door1open=0     local
  90.         int    door2open=0     local
  91.         int    door3open=0     local
  92.         #    keyframe and soundloop control variables
  93.         int    wheelloop       local     #motion of the wheel in tracks
  94.         int    rotation=-1    local     #keyframe for wheel spin
  95.         int    locomotion=-1      local     #spinning of the wheel
  96.         int    lpulleyrun      local     #keyframe for pulleys
  97.         int    rpulleyrun      local     #keyframe for pulleys
  98.         int doorloops       local     #for door loop sounds
  99.         int    pulleyspin=0    local
  100.         int    animID=-1        local
  101.         int    scene=0            local
  102.  
  103.         #    vectors
  104.         vector    tempVEC        local
  105. end
  106. # ========================================================================================
  107.  
  108. code
  109.  
  110. startup:
  111.         
  112.         #AttachThingToThing(wheelbracket, wheel);
  113.         
  114.         player = GetLocalPlayerThing();
  115.         
  116. return;
  117.  
  118. #----------------------------------------------------------------------------------                
  119.  
  120. activated:
  121.  
  122.         
  123.         If (IsMoving(scene) != 0) return;
  124.         If (GetSenderRef() != lever) return;
  125.         
  126.             #printint(rotation);
  127.                         # Remember the current camera
  128.             scene = 1;
  129.             curCam = GetCurrentCamera();
  130.  
  131.                         # Disable and hide player
  132.             SetThingFlags(player, 0x80000);
  133.             SetActorFlags(player, 0x200000);
  134.             StartCutscene(1);
  135.         
  136.         
  137. #checks for 1st sluice
  138.         If ((GetSenderRef() == lever) && (ActivatePos == 0 ))
  139.         {
  140.             Call indywheelscript;    #get the camera, play indy's anims and the lever anim
  141.             
  142.             # Stop wheel's animations and sounds in preparation for movement
  143.             If (rotation!=-1)
  144.                 {
  145.                 rotation=-1;
  146.                 StopThing(wheel);
  147.                 # Stop the wall gear from rotating
  148.                 SendMessage(gearcog0, user1);
  149.                 
  150.                 }
  151.             If (locomotion !=-1)
  152.                 {
  153.                 StopSound(locomotion, 0.5);
  154.                 locomotion=-1;
  155.                 }
  156.                 # Move the wheel
  157.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  158.             
  159.             AttachThingToThing(wheelbracket, wheel);
  160.             tempVEC= (GetThingPos(wheelpos1));
  161.             animID = MoveThingToPos(wheel, tempVEC, 2);
  162.             # move the rope
  163.             tempVEC= (GetThingPos(ropepos1));
  164.             MoveThingToPos(rope, tempVEC, 2);
  165.             # move the pulleys
  166.             tempVEC= (GetThingPos(lpulleypos1));
  167.             MoveThingToPos(lpulley, tempVEC, 2);
  168.             tempVEC= (GetThingPos(rpulleypos1));
  169.             MoveThingToPos(rpulley, tempVEC, 2);
  170.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  171.  
  172.             WaitForAnimStop(animID);
  173.             PlaySoundLocal(wheelstop, 1.0, 0, 0x0, 0);
  174.             StopSound(wheelloop, 0.0);
  175.                 # lateral wheel movement, pulley keyframes
  176.             
  177.             tempVEC= (GetThingPos(wheelpos2));
  178.             animID = MoveThingToPos(wheel, tempVEC, 2);
  179.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  180.             Rotate(lpulley, 360, 1, 0.5);
  181.             Rotate(rpulley, 360, 1, 0.5);
  182.             pulleyspin = 1;
  183.  
  184.             WaitForAnimStop(animID);
  185.             PlaySoundLocal(wheelstop, 1.0, 0, 0x0, 0);
  186.             
  187.             pulleyspin = 0;
  188.             StopSound(wheelloop, 0.0);
  189.             StopThing(lpulley); 
  190.             StopThing(rpulley);
  191.  
  192.                 # wheel into destination slot, check for spinning
  193.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  194.             tempVEC= (GetThingPos(wheelpos3));
  195.             animID = MoveThingToPos(wheel, tempVEC, 2);
  196.             # move the rope
  197.             tempVEC= (GetThingPos(ropepos0));
  198.             MoveThingToPos(rope, tempVEC, 2);
  199.             # move the pulleys
  200.             tempVEC= (GetThingPos(lpulleypos0));
  201.             MoveThingToPos(lpulley, tempVEC, 2);
  202.             tempVEC= (GetThingPos(rpulleypos0));
  203.             MoveThingToPos(rpulley, tempVEC, 2);
  204.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  205.  
  206.             # wait for stop, detach bracket, stop sounds
  207.             WaitForAnimStop(animID);
  208.             DetachThing(wheelbracket);
  209.             PlaySoundLocal(wheelstop, 1.0, 0, 0x0, 0);
  210.             StopSound(wheelloop, 0.5);
  211.             ActivatePos = 3;
  212.             Sleep(0.5);
  213.             Call gatecheck;
  214.          
  215.          return;
  216.          }
  217.          
  218.  
  219. #checks for 2nd sluice
  220.          If ((Getsenderref() == lever) && (ActivatePos == 3))
  221.          {
  222.             Call indywheelscript;
  223.                         
  224.             # Stop wheel's animations and sounds in preparation for movement       
  225.             If (rotation!=-1)
  226.                 {
  227.                 rotation=-1;
  228.                 StopThing(wheel);
  229.                 # Stop the wall gear from rotating
  230.                 SendMessage(gearcog1, user1);
  231.                 
  232.                 }
  233.             If (locomotion!=-1)
  234.                 {
  235.                 StopSound(locomotion, 0.5);
  236.                 locomotion=-1;
  237.                 }
  238.  
  239.                 #movethewheel
  240.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  241.             
  242.             AttachThingToThing(wheelbracket, wheel);
  243.             tempVEC= (GetThingPos(wheelpos2));
  244.             animID = MoveThingToPos(wheel, tempVEC, 2);
  245.             # move the rope
  246.             tempVEC= (GetThingPos(ropepos1));
  247.             MoveThingToPos(rope, tempVEC, 2);
  248.             # move the pulleys
  249.             tempVEC= (GetThingPos(lpulleypos1));
  250.             MoveThingToPos(lpulley, tempVEC, 2);
  251.             tempVEC= (GetThingPos(rpulleypos1));
  252.             MoveThingToPos(rpulley, tempVEC, 2);
  253.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  254.  
  255.             WaitForAnimStop(animID);
  256.             PlaySoundLocal(wheelstop, 1.0, 0, 0x0, 0);
  257.             StopSound(wheelloop, 0.5);
  258.                 #lateral wheel movement, pulley keyframes
  259.             tempVEC= (GetThingPos(wheelpos4));
  260.             animID = MoveThingToPos(wheel, tempVEC, 2);
  261.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  262.             Rotate(lpulley, 360, 1, 0.5);
  263.             Rotate(rpulley, 360, 1, 0.5);
  264.             pulleyspin = 1;
  265.  
  266.             WaitForAnimStop(animID);
  267.             pulleyspin = 0;
  268.             PlaySoundLocal(wheelstop, 1.0, 0, 0x0, 0);
  269.             StopSound(wheelloop, 0.5);
  270.             StopThing(lpulley); 
  271.             StopThing(rpulley);
  272.             
  273.             # wheel into destination slot, check for spinning
  274.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  275.             tempVEC= (GetThingPos(wheelpos5));
  276.             animID = MoveThingToPos(wheel, tempVEC, 2);
  277.             # move the rope
  278.             tempVEC= (GetThingPos(ropepos0));
  279.             MoveThingToPos(rope, tempVEC, 2);
  280.             # move the pulleys
  281.             tempVEC= (GetThingPos(lpulleypos0));
  282.             MoveThingToPos(lpulley, tempVEC, 2);
  283.             tempVEC= (GetThingPos(rpulleypos0));
  284.             MoveThingToPos(rpulley, tempVEC, 2);
  285.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  286.  
  287.             # wait for stop, detach bracket, stop sounds
  288.             WaitForAnimStop(animID);
  289.  
  290.             DetachThing(wheelbracket);
  291.             StopSound(wheelloop, 0.5);
  292.             ActivatePos = 5;
  293.             Sleep(0.5);
  294.             Call gatecheck;
  295.             return;
  296.          }
  297.  
  298. #checks for 3rd sluice
  299.          If ((Getsenderref() == lever) && (ActivatePos == 5))
  300.          {
  301.        
  302.             Call indywheelscript;
  303.             
  304.             # Stop wheel's animations and sounds in preparation for movement
  305.             
  306.             If (rotation!=-1)
  307.                 {
  308.                 rotation=-1;
  309.                 StopThing(wheel);
  310.                 # Stop the wall gear from rotating
  311.                 SendMessage(gearcog2, user1);
  312.                 
  313.                 }
  314.             If (locomotion!=-1)
  315.                 {
  316.                 StopSound(locomotion, 0.5);
  317.                 locomotion = -1;
  318.                 }
  319.             
  320.                 # movethewheel
  321.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  322.             
  323.             AttachThingToThing(wheelbracket, wheel);
  324.             tempVEC= (GetThingPos(wheelpos4));
  325.             animID = MoveThingToPos(wheel, tempVEC, 2);
  326.             # move the rope
  327.             tempVEC= (GetThingPos(ropepos1));
  328.             MoveThingToPos(rope, tempVEC, 2);
  329.             # move the pulleys
  330.             tempVEC= (GetThingPos(lpulleypos1));
  331.             MoveThingToPos(lpulley, tempVEC, 2);
  332.             tempVEC= (GetThingPos(rpulleypos1));
  333.             MoveThingToPos(rpulley, tempVEC, 2);
  334.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  335.  
  336.             WaitForAnimStop(animID);
  337.  
  338.             StopSound(wheelloop, 0.5);
  339.                 # lateral wheel movement, pulley keyframes
  340.             tempVEC= (GetThingPos(wheelpos6));
  341.             animID = MoveThingToPos(wheel, tempVEC, 2);
  342.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  343.             Rotate(lpulley, 360, 1, .5);
  344.             Rotate(rpulley, 360, 1, .5);
  345.             pulleyspin = 1;
  346.  
  347.             WaitForAnimStop(animID);
  348.  
  349.             pulleyspin = 0;
  350.             StopSound(wheelloop, 0.5);
  351.             StopThing(lpulley); 
  352.             StopThing(rpulley);
  353.  
  354.                 # wheel into destination slot, check for spinning
  355.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  356.             tempVEC= (GetThingPos(wheelpos7));
  357.             animID = MoveThingToPos(wheel, tempVEC, 2);
  358.             # move the rope
  359.             tempVEC= (GetThingPos(ropepos0));
  360.             MoveThingToPos(rope, tempVEC, 2);
  361.             # move the pulleys
  362.             tempVEC= (GetThingPos(lpulleypos0));
  363.             MoveThingToPos(lpulley, tempVEC, 2);
  364.             tempVEC= (GetThingPos(rpulleypos0));
  365.             MoveThingToPos(rpulley, tempVEC, 2);
  366.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  367.  
  368.             WaitForAnimStop(animID);
  369.  
  370.             DetachThing(wheelbracket);
  371.             StopSound(wheelloop, 0.5);
  372.             ActivatePos = 7;
  373.             Sleep(0.5);
  374.             Call gatecheck;
  375.             return;
  376.          }
  377.  
  378. #checks for 4th sluice
  379.          If ((Getsenderref() == lever) && (ActivatePos == 7))
  380.          {
  381.        
  382.             Call indywheelscript;
  383.  
  384.             # Stop wheel's animations and sounds in preparation for movement
  385.             
  386.             If (rotation!=-1)
  387.                 {
  388.                 rotation=-1;
  389.                 StopThing(wheel);
  390.                 # Stop the wall gear from rotating
  391.                 SendMessage(gearcog3, user1);
  392.                 
  393.                 }
  394.             If (locomotion!=-1)
  395.                 {
  396.                 StopSound(locomotion, 0.5);
  397.                 locomotion=-1;
  398.                 }
  399.             
  400.                 #movethewheel
  401.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  402.             
  403.             AttachThingToThing(wheelbracket, wheel);
  404.             tempVEC= (GetThingPos(wheelpos6));
  405.             animID = MoveThingToPos(wheel, tempVEC, 2);
  406.             # move the rope
  407.             tempVEC= (GetThingPos(ropepos1));
  408.             MoveThingToPos(rope, tempVEC, 2);
  409.             # move the pulleys
  410.             tempVEC= (GetThingPos(lpulleypos1));
  411.             MoveThingToPos(lpulley, tempVEC, 2);
  412.             tempVEC= (GetThingPos(rpulleypos1));
  413.             MoveThingToPos(rpulley, tempVEC, 2);
  414.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  415.  
  416.             WaitForAnimStop(animID);
  417.  
  418.             StopSound(wheelloop, 0.5);
  419.                 # lateral wheel movement, pulley keyframes
  420.             tempVEC= (GetThingPos(wheelpos1));
  421.             animID = MoveThingToPos(wheel, tempVEC, 2);
  422.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  423.             Rotate(lpulley, -360, 1, .5);
  424.             Rotate(rpulley, -360, 1, .5);
  425.             pulleyspin = 2;
  426.  
  427.             WaitForAnimStop(wheel, animID);
  428.  
  429.             pulleyspin = 0;
  430.             StopThing(lpulley); 
  431.             StopThing(rpulley);
  432.             StopSound(wheelloop, 0.5);
  433.                 # wheel into destination slot, check for spinning
  434.             PlaySoundLocal(wheelstart, 0.5, 0, 0x0, 0);
  435.             tempVEC= (GetThingPos(wheelpos0));
  436.             animID = MoveThingToPos(wheel, tempVEC, 2);
  437.             # move the rope
  438.             tempVEC= (GetThingPos(ropepos0));
  439.             MoveThingToPos(rope, tempVEC, 2);
  440.             # move the pulleys
  441.             tempVEC= (GetThingPos(lpulleypos0));
  442.             MoveThingToPos(lpulley, tempVEC, 2);
  443.             tempVEC= (GetThingPos(rpulleypos0));
  444.             MoveThingToPos(rpulley, tempVEC, 2);
  445.             wheelloop = PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  446.  
  447.             WaitForAnimStop(animID);
  448.  
  449.             DetachThing(wheelbracket);
  450.             StopSound(wheelloop, 0.5);
  451.             ActivatePos = 0;
  452.             Sleep(0.5);
  453.             Call gatecheck;
  454.             return;       
  455.             
  456.          }
  457.  
  458.  
  459.  
  460. return;
  461. #=================================================================
  462. arrived:
  463.  
  464.         If ((GetSenderRef() == wheel) && (rotation != -1))
  465.         {
  466.  
  467.                 If (ActivatePos == 0)
  468.                     {
  469.                     TeleportThing(wheel, wheelpos0);
  470.                     }
  471.                 If (ActivatePos == 3)
  472.                     {
  473.                     TeleportThing(wheel, wheelpos3);
  474.                     }
  475.                 If (ActivatePos == 5)
  476.                     {
  477.                     TeleportThing(wheel, wheelpos5);
  478.                     }
  479.                 If (ActivatePos == 7)
  480.                     {
  481.                     TeleportThing(wheel, wheelpos7);
  482.                     }
  483.                 Rotate(wheel, 360, 2, 2);
  484.                 rotation = 1;
  485.         }
  486.  
  487.         If ((GetSenderRef() == lpulley) && (pulleyspin == 1))
  488.                 {
  489.                 Rotate(lpulley, 360, 1, .5);
  490.                 Rotate(rpulley, 360, 1, .5);
  491.                 }
  492.  
  493.         If ((GetSenderRef() == lpulley) && (pulleyspin == 2))
  494.                 {
  495.                 Rotate(lpulley, -360, 1, .5);
  496.                 Rotate(rpulley, -360, 1, .5);
  497.                 }
  498.  
  499.         If (GetSenderID() == 1)
  500.                 {
  501.                 StopSound(doorloops, 0.0);
  502.                 PlaySoundThing(wheelstop, door0, 1, -1, -1, 0x0);
  503.                 }
  504.         return;
  505.  
  506. #----------------------------------------------------------------------------------                
  507. user0:
  508. gatecheck:
  509. #print("gatecheck called");
  510.         
  511.            # pulley cleanup
  512.         TeleportThing(lpulley, lpulleypos0);
  513.         TeleportThing(rpulley, rpulleypos0);
  514.  
  515.  
  516.         If (GetCurFrame(doorcampos) != 0)
  517.                 {
  518.                 MoveToFrame(doorcampos, 0, 100);
  519.                 }
  520.                 
  521.         # return wheel cams
  522.         If (GetCurFrame(wheelcampos3) != 0)
  523.             {
  524.             MoveToFrame(wheelcampos3, 0, 100);
  525.             WaitForStop(wheelcampos3);
  526.             }
  527.         
  528.         If (GetCurFrame(wheelcampos2) != 0)
  529.             {
  530.             MoveToFrame(wheelcampos2, 0, 100);
  531.             WaitForStop(wheelcampos2);
  532.             }
  533.  
  534.         If (GetCurFrame(wheelcampos1) != 0)
  535.             {
  536.             MoveToFrame(wheelcampos1, 0, 100);
  537.             WaitForStop(wheelcampos1);
  538.             }
  539.  
  540.         If (GetCurFrame(wheelcampos) == 1)
  541.             {
  542.             MoveToFrame(wheelcampos, 0, 100);
  543.             WaitForStop(wheelcampos);
  544.             }
  545.         
  546.         
  547.         If (GetFaceGeomode(surf0) == 4) 
  548.             {
  549.                 If ((door0open == 0) && (ActivatePos == 0))    # door is unopened, water in the sluice
  550.                 {
  551.                    
  552.                     #print("Apos0, water in the sluice, door unopened");
  553.                     Rotate(wheel, 360, 2, 2);
  554.                     SendMessage(gearcog0, user0);
  555.                     Call wheelcam0;
  556.                     rotation = 1;
  557.                     locomotion = PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  558.                     WaitForStop(wheelcampos);
  559.                     sleep(.5);
  560.                     # goto doorcamposition
  561.                     Call doorcamscript;     
  562.                     door0open = 1;
  563.                     sleep(1.0);
  564.                     Call camreturn;
  565.                 }
  566.             
  567.                 else if ((door0open == 1) && (ActivatePos == 0))    # door already opened, water in the sluice
  568.                 {
  569.                     #print("Apos0, water in the sluice, door already opened");
  570.                     Rotate(wheel, 360, 2, 2); 
  571.                     SendMessage(gearcog0, user0);
  572.                     Call wheelcam0;
  573.                     rotation = 1;
  574.                     locomotion = PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  575.                     WaitForStop(wheelcampos);
  576.                     Call camreturn;
  577.                 }
  578.                 
  579.                 else        #  no water in the sluice
  580.                 {
  581.                     #print("Apos0, no water in the sluice");
  582.                     rotation = -1;
  583.                     SendMessage(gearcog0, user1);
  584.                     Call wheelcam0;
  585.                     Sleep(.5);
  586.                     WaitForStop(wheelcampos);
  587.                     Call camreturn;
  588.                 }
  589.                 return;
  590.             }
  591.         
  592.         If (GetFaceGeomode(surf1) == 4) 
  593.             {
  594.                 If ((door1open == 0) && (ActivatePos == 3))    #water in the sluice, door unopened
  595.                     {
  596.                     #print("Apos3, water in the sluice, door unopened");
  597.                     Rotate(wheel, 360, 2, 2); 
  598.                     SendMessage(gearcog1, user0);
  599.                     Call wheelcam1;
  600.                     rotation = 1;
  601.                     locomotion = PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  602.                     WaitForStop(wheelcampos1);
  603.                     sleep(.5);
  604.                     # goto doorcamposition
  605.                     Call doorcamscript;
  606.                     door1open = 1;
  607.                     sleep(1.0);
  608.                     Call camreturn;
  609.                     }
  610.             
  611.                 else if ((door1open == 1) && (ActivatePos == 3))    #water in the sluice, door already open 
  612.                     {
  613.                     #print("Apos3, water in the sluice, door already opened");
  614.                     Rotate(wheel, 360, 2, 2); 
  615.                     SendMessage(gearcog1, user0);
  616.                     Call wheelcam1;
  617.                     rotation = 1;
  618.                     locomotion = PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  619.                     WaitForStop(wheelcampos1);
  620.                     Call camreturn;
  621.                     }
  622.  
  623.                 else        #  no water in the sluice
  624.                     {
  625.                     #print("Apos3, no water in the sluice");
  626.                     rotation = -1;
  627.                     SendMessage(gearcog1, user1);
  628.                     Call wheelcam1;
  629.                     Sleep(.5);
  630.                     WaitForStop(wheelcampos1);
  631.                     Call camreturn;
  632.                     }
  633.                 return;
  634.             
  635.         
  636.             }
  637.                 
  638.         
  639.         If (GetFaceGeomode(surf2) == 4) 
  640.             {
  641.                 If ((door2open == 0) && (ActivatePos == 5))    #water in the sluice, door unopened
  642.                     {
  643.                     #print("Apos5, water in the sluice, door unopened");
  644.                     Rotate(wheel, 360, 2, 2); 
  645.                     SendMessage(gearcog2, user0);
  646.                     Call wheelcam2;
  647.                     rotation = 1;
  648.                     PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  649.                     WaitForStop(wheelcampos2);
  650.                     Sleep(.5);
  651.                     # goto doorcamposition
  652.                     Call doorcamscript;
  653.                     door2open = 1;
  654.                     Sleep(1.0);
  655.                     Call camreturn;
  656.                     }
  657.                 
  658.                 else if ((door2open == 1) && (ActivatePos == 5))    #water in the sluice, door already opened
  659.                     {
  660.                     #print("Apos5, water in the sluice, door already opened");
  661.                     Rotate(wheel, 360, 2, 2); 
  662.                     SendMessage(gearcog2, user0);
  663.                     Call wheelcam2;
  664.                     rotation = 1;
  665.                     PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  666.                     WaitForStop(wheelcampos2);
  667.                     Call camreturn;
  668.                     }
  669.  
  670.                 else    #  no water in the sluice
  671.                     {
  672.                     #print("Apos5, no water in the sluice");
  673.                     rotation = -1;
  674.                     SendMessage(gearcog2, user1);
  675.                     Call wheelcam2;
  676.                     Sleep(.5);
  677.                     WaitForStop(wheelcampos2);
  678.                     Call camreturn;
  679.                     }
  680.                 return;
  681.             }
  682.                 
  683.         
  684.         If (GetFaceGeomode(surf3) == 4) 
  685.             {
  686.                 If ((door3open == 0) && (ActivatePos == 7))    #door unopened, water in the sluice
  687.                     {
  688.                     #print("Apos7, water in the sluice, door unopened");
  689.                     Rotate(wheel, 360, 2, 2); 
  690.                     SendMessage(gearcog3, user0);
  691.                     Call wheelcam3;
  692.                     rotation = 1;
  693.                     PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  694.                     WaitForStop(wheelcampos3);
  695.                     sleep(.5);
  696.                     # goto doorcamposition
  697.                     Call doorcamscript;
  698.                     door3open = 1;
  699.                     sleep(1.0);
  700.                     Call camreturn;
  701.                     }
  702.             
  703.                 else if ((door3open == 1) && (ActivatePos == 7))    #door already opened, water in the sluice
  704.                     {
  705.                     #print("Apos7, water in the sluice, door already opened");
  706.                     Rotate(wheel, 360, 2, 2); 
  707.                     SendMessage(gearcog3, user0);
  708.                     Call wheelcam3;
  709.                     rotation = 1;
  710.                     PlaySoundThing(locowave, wheel, 1, -1, -1, 0x1);
  711.                     WaitForStop(wheelcampos3);
  712.                     Call camreturn;
  713.                     }
  714.  
  715.                 else    #  no water in the sluice
  716.                     {
  717.                     #print("Apos7, no water in the sluice");
  718.                     rotation = -1;
  719.                     SendMessage(gearcog3, user1);
  720.                     Call wheelcam3;
  721.                     Sleep(.5);
  722.                     WaitForStop(wheelcampos3);
  723.                     Call camreturn;
  724.                     }
  725.                 return;
  726.              }
  727. return;
  728.  
  729. #----------------------------------------------------------------------------------                
  730. wheelcam0:
  731.         
  732.         {
  733.         # set the camera to view sluice
  734.         SetCameraFocus(2, wheelcampos);
  735.         SetCamerasecondaryFocus(2, wheelpos0);
  736.         SetCurrentCamera(2);
  737.         SetCameraFOV(90, 0, 0);
  738.         MoveToFrame(wheelcampos, 1, 1.0);
  739.         Sleep(2.0);
  740.         }
  741.         
  742. return;
  743. #----------------------------------------------------------------------------------                
  744. wheelcam1:
  745.  
  746.         {
  747.         # set the camera to view sluice
  748.         SetCameraFocus(2, wheelcampos1);
  749.         SetCamerasecondaryFocus(2, wheelpos3);
  750.         SetCurrentCamera(2);
  751.         SetCameraFOV(90, 0, 0);
  752.         MoveToFrame(wheelcampos1, 1, 1.0);
  753.         Sleep(2.0);
  754.         }
  755.         
  756. return;
  757.  
  758.  
  759. #----------------------------------------------------------------------------------                
  760. wheelcam2:
  761.  
  762.         {
  763.         # set the camera to view sluice
  764.         SetCameraFocus(2, wheelcampos2);
  765.         SetCamerasecondaryFocus(2, wheelpos5);
  766.         SetCurrentCamera(2);
  767.         SetCameraFOV(90, 0, 0);
  768.         MoveToFrame(wheelcampos2, 1, 1.0);
  769.         Sleep(2.0);
  770.         }
  771.         
  772. return;
  773.  
  774. #----------------------------------------------------------------------------------                
  775. wheelcam3:
  776.  
  777.         {
  778.         # set the camera to view sluice
  779.         SetCameraFocus(2, wheelcampos3);
  780.         SetCamerasecondaryFocus(2, wheelpos7);
  781.         SetCurrentCamera(2);
  782.         SetCameraFOV(90, 0, 0);
  783.         MoveToFrame(wheelcampos3, 1, 1.0);
  784.         Sleep(2.0);
  785.         }
  786.         
  787. return;
  788.  
  789. #----------------------------------------------------------------------------------                
  790. doorcamscript:
  791.         {     
  792.              
  793.         # goto door cam
  794.         SetCameraLookInterp(2, 0);
  795.         SetCameraFocus(2, doorcampos);
  796.         SetCameraSecondaryFocus(2, doorcamtarget);
  797.         # doorsounds
  798.         PlaySoundLocal(opensound, 1.0, 0, 0x0, 1);
  799.         #doorloops =  PlaySoundLocal(wheelmove, 1.0, 0, 0x1, 0);
  800.         movetoframe(doorcampos, 1, .5);
  801.         
  802.              # determine door to be moved and move it
  803.         If (ActivatePos == 0)
  804.                 {
  805.                 PlaySoundLocal(dangercue, 1.0, 0.0, 0x0, 0);
  806.                 MoveToFrame(door0, 1, .5);
  807.                 WaitforStop(door0);
  808.                 Sleep(.5);
  809.                 return;
  810.                 }
  811.    else If (ActivatePos == 3)
  812.                 {
  813.                 PlaySoundLocal(dangercue, 1.0, 0.0, 0x0, 0);
  814.                 MoveToFrame(door1, 1, .5);
  815.                 WaitforStop(door1);
  816.                 Sleep(.5);
  817.                 return;
  818.                 }
  819.    else If (ActivatePos == 5)
  820.                 {
  821.                 PlaySoundLocal(dangercue, 1.0, 0.0, 0x0, 0);
  822.                 MoveToFrame(door2, 1, .5);
  823.                 WaitforStop(door2);
  824.                 Sleep(.5);
  825.                 return;
  826.                 }
  827.    else If (ActivatePos == 7)
  828.                 {
  829.                 PlaySoundLocal(dangercue, 1.0, 0.0, 0x0, 0);
  830.                 MoveToFrame(door3, 1, .5);
  831.                 WaitforStop(door3);
  832.                 Sleep(.5);
  833.                 return;
  834.                 }
  835.         }        
  836. return;        
  837.  
  838.  
  839.  
  840. #----------------------------------------------------------------------------------                
  841. camreturn:
  842.  
  843.         {
  844. # Return control and camera to player
  845.         # return actor to start position facing lever
  846.         SetThingMaxRotVel(indy, 360);
  847.         AISetLookThingEyeLevel(indy, lever);
  848.         # hide actor, restore the player
  849.         SetThingFlags(indy, 0x80000);
  850.         ClearThingFlags(player, 0x80000);
  851.         ClearActorFlags(player, 0x200000);
  852.         Sendmessage(camcog, user1);
  853.         EndCutscene();
  854.         SetCameraFOV(90, 0, 0.0);
  855.         movetoframe(camerapos, 0, 200);
  856.         SetCameraLookInterp(2,0);
  857.         scene = 0;
  858.         }
  859.         
  860. return;
  861.  
  862. #----------------------------------------------------------------------------------                
  863. indywheelscript:
  864.         {
  865.             # line up the actor    and show him
  866.             CopyPlayerHolsters(player, indy); # make sure actor has matching props
  867.             #CopyOrientAndPos(player, indy);
  868.             ClearThingFlags(indy, 0x80000);
  869.             
  870.             # Cut to cutscene camera
  871.             SetCameraFocus(2, camerapos);
  872.             SetCamerasecondaryFocus(2, indy);
  873.             SetCameraInterpSpeed(2,1.5);
  874.             SetCameraLookInterp(2,1);
  875.             Sendmessage(camcog, user0);
  876.             SetCameraFOV(70, 0, 0.0);
  877.  
  878.             
  879.             # Play Indy's and the lever's Anims
  880.             PlayKey(lever, lever_down, 4, 0x12, 0);
  881.             PlayKey(indy, in_pull, 4, 0x12, 0);
  882.             
  883.             Sleep(1.0);
  884.             PlaySoundLocal(leverpull, 1.0, 0, 0x0, 0);
  885.             
  886.             MovetoFrame(camerapos, 1, .5);
  887.             Sleep(1.5);
  888.              
  889.             PlaySoundLocal(leverset, 0.5, 0, 0x0, 0);
  890.             Sleep(0.5);
  891.  
  892.             # indyactor turns to view the wheel's motion
  893.             SetThingMaxRotVel(indy, 80);
  894.             AISetLookThingEyeLevel(indy, wheel);
  895.             sleep(1.0);
  896.             SetCameraFOV(100, 1, 1.0);
  897.             SetCamerasecondaryFocus(2, wheel);
  898.         }
  899. return;        
  900.  
  901. #----------------------------------------------------------------------------------                
  902.  
  903.  
  904.  
  905.  
  906.  
  907. end
  908.